@extends('layouts.app')

@section('content')
    <div class="container">
        <div class="row justify-content-center">
            <div class="col-md-10">
                <div class="card card-default">
                    <div class="card-header">
                        <h4 class="text-center"><i class="icon-bell-alt"></i> 我的通知</h4>
                    </div>

                    <div class="card-body">
                        @if ($notifications->count())
                            <div>
                                @foreach($notifications as $v)
                                    @if($v->type == 'App\Notifications\TopicReply')
                                        <div class="media">
                                            <div class="pull-left">
                                                <a href="{{route('user',[$v->data['reply_user']['id']])}}">
                                                    <img alt="" src="{{url($v->data['reply_user']['avatar'])}}" class="media-object img-thumbnail" style="width: 48px; height: 48px;">
                                                </a>
                                            </div>
                                            <div style="margin-left: 12px;">
                                                <div class="media-heading" >
                                                    <a href="{{route('user',[$v->data['reply_user']['id']])}}" title="{{$v->data['reply_user']['name']}}">
                                                        {{$v->data['reply_user']['name']}}
                                                    </a>
                                                    <span> 回复了  </span>
                                                    <a href="{{route('topics.show',[ $v->data['topic']['category_id'],$v->data['topic']['id'] ])}}">{{$v->data['topic']['title']}}</a>
                                                </div>
                                                <div style="margin-top: 10px;">
                                                    {{\gl\clear_str_ellipsis($v->data['reply']['content'],200)}}
                                                </div>
                                            </div>
                                        </div>
                                        <span class="operate pull-right links" style="float:right;margin-top: -44px;">
                                            <a class="icon-large" href="javascript:void(0);"  title="时间">{{$v->created_at->diffForHumans()}}</a>
                                        </span>
                                        <hr>
                                    @elseif($v->type == 'App\Notifications\Reply')
                                        <div class="media">
                                            <div class="pull-left">
                                                <a href="{{route('user',[$v->data['reply_user']['id']])}}">
                                                    <img alt="" src="{{url($v->data['reply_user']['avatar'])}}" class="media-object img-thumbnail" style="width: 48px; height: 48px;">
                                                </a>
                                            </div>
                                            <div style="margin-left: 12px;">
                                                <div class="media-heading" >
                                                    <a href="" title="">
                                                        {{$v->data['reply_user']['name']}}
                                                    </a>
                                                    <span> 在话题  </span>
                                                    <a href="{{route('topics.show',[ $v->data['topic']['category_id'],$v->data['topic']['id'] ])}}">{{$v->data['topic']['title']}}</a>
                                                    中提起了你
                                                </div>
                                                <div style="margin-top: 10px;">
                                                    {!! $v->data['reply']['content'] ?? '' !!}
                                                </div>
                                            </div>
                                        </div>
                                        <span class="operate pull-right links" style="float:right;margin-top: -44px;">
                                            <a class="icon-large" href="javascript:void(0);"  title="时间">{{$v->created_at->diffForHumans()}}</a>
                                        </span>
                                        <hr>
                                    @endif
                                @endforeach
                                {{$notifications->links()}}
                            </div>
                        @endif
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection

@section('scripts')
    <script>
        new Vue({
            el:'#app',
            mounted() {

            },
            data() {
                return {

                }
            },
            methods:{


            }
        });
    </script>
@endsection